package sivak.net.proc.dyn.single_lib_2;

/**
 * Created with IntelliJ IDEA.
 * User: root
 * Date: 1/23/13
 * Time: 2:41 PM
 * To change this template use File | Settings | File Templates.
 */
public class SingleLLUtils_Test {
    public static void main(String[] args) {
        Node tail = generateIter1(10);
        Node test = null;
        tail = SingleLLUtils_2.add(tail, 1);
        tail = SingleLLUtils_2.add(tail, 2);
        tail = SingleLLUtils_2.add(tail, 3);
        tail = SingleLLUtils_2.add(tail, 3, 8);
        tail = SingleLLUtils_2.remove(tail, 3);
        tail = SingleLLUtils_2.remove(tail);
        printList(tail);
    }

    public static Node generateIter1(int len) {
        Node tail = null;
        for (int k = len - 1; k >= 0; k--) {
            tail = new Node(k, tail);
        }
        return tail;
    }

    public static void printList(Node tail) {
        while (tail != null) {
            System.out.print(" " + tail.value);
            tail = tail.next;
        }
    }
}
